package net.com.hydroPK.net.packethandler;
import net.com.hydroPK.Engine;
import net.com.hydroPK.model.Player;
import net.com.hydroPK.npcs.NPC;
import net.com.hydroPK.io.ActionSender;



import java.io.*;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;

public class NPCOption1 implements Packet {
    
public int thiefState = 0;
/**
     * Handles the first NPC option.
     *
     * @param p          The Player which the frame should be handled for.
     * @param packetId   The packet id this belongs to.
     * @param packetSize The amount of bytes being recieved for this packet.
     */
	public NPC n;
    public void handlePacket(Player p, int packetId, int packetSize) {
        if (p == null || p.stream == null) {
            return;
        }
        int npcSlot = p.stream.readUnsignedWordA();
        int npcType = Engine.npcs[npcSlot].npcType;
        int npcId = p.stream.readUnsignedWord();
		NPC pnp = Engine.npcs[p.clickId];
		NPC np = Engine.npcs[p.FamiliarID];
        switch (npcType) {
            case 575: // Hickton; Fletching Master
                p.sendNpcDialogue(0, 575, "Hickton", "Oh hello there, what you want?",
                        "Wanna buy something? Just trade me!");
                break;
            case 1512: // Adventurer
                p.sendDialogueOptions(2, "Green Dragons [Wilderness]", "Black Dragons [Multi-Wilderness]",
                        "[Coming Soon...]");
                break;
            case 4906: // Woodcutting tutor
                p.sendDialogueOptions(6, "Teleport me to Shilo please!", "Nothing,  nvm.");
                break;
            case 650: // Warrior
                p.sendDialogueOptions(5, "Armadyl dungeon", "Bandos dungeon",
                        "Saradomin Dungeon", "Zamorak Dungeon", "Nevermind");
                break;
            case 2024: // Strange old man
                p.sendPlayerDialogue(1, "Errr... what're you digging for?");
                break;
            case 5488: // Magnus Gram
                p.sendNpcDialogue(10, 5488, "Magnus Gram", "Hey, i'm guessin' you're here for barrows.",
                        "Do you want to start it, or learn about it?");
	     	break;
	    case 2244://lumby guide
		p.sendNpcDialogueNew(10, 2244, 9846, "Lumbridge Guide", "Hello, "+p.username+", if you need any help just ::yell",
			"'Need help at helpdesk', and if a mod is on they will come!");
		break;
	    case 2308://capt arnav
		p.sendNpcDialogueNew(10, 2308, 9760, "Capt'Arnav", "This portal takes you to a pvp area.. Don't",
			"worry, though, you spawn in a safe area.");
		break;
	    case 7939://vant
		p.sendNpcDialogueNew(10, 7939, 9846, "Sir Vant", "Welcome to Rune Resort, "+p.username+"! To go to the mainland,",
			"simply step through any portal.");
		break;
	    case 8033://rc wizard
		if(p.skillLvl[20] < 50){
		p.sendNpcDialogueNew(10, 8033, 9840, "Wizard", "*Fails to conceal laughter* ...HaHa!! I'm sorry! I don't",
			"have time to talk to runecrafting noobs!");
		}
		else if(p.skillLvl[20] >= 50 && p.skillLvl[20] < 99){
		     p.sendNpcDialogueNew(10, 8033, 9850, "Wizard", "Hmmm... You have a nice runecrafting level! Good job!",
			"I have some robes for you to show your accomplishment!");
			p.shopHandler.openshop(p, 23);
                     }
		else if(p.skillLvl[20] == 99){
		     p.sendNpcDialogueNew(10, 8033, 9823, "Wizard", "Oh, my! A runecrafting master! I've added a nice",
			"cape and hood in the shop for you!");
			p.shopHandler.openshop(p, 24);
                     }
		
		break;
	    case 2270://martin thwait
		p.sendNpcDialogueNew(0, 2270, 9785, "Martin Thwait", "Can't you see I don't have time to chat?", 
			"Just trade me if you want to buy a skillcape!");
		break;
	    case 7142://jail guard
		p.sendPlayerDialogue(1, "I don't think I should interrupt his work.");
		break;
            case 553: // Aubury
                p.sendNpcDialogue(0, 553, "Aubury", "If you want Runecrafting supplies, trade me", 
                        "Or if you want to go to the altars, click teleport on me");
                break;
	    case 945: // RS Guide(staff shop)
                if (p.rights > 0){
                p.sendNpcDialogueNew(0, 945, 9835, "Staff Shop Owner", "Oh, hello there! You must be staff! I guess you can", 
                        "look at my shop! And..uh.. wheres my drink? *hic*");
                     p.shopHandler.openshop(p, 25);
                 }
                 else
                   { p.sendNpcDialogueNew(0, 945, 9790, "Staff Shop Owner", "GET OUT OF HERE!!!!!!!!!", 
                        "NOOOOOOOOOOOOOOWWWWWWWWW!");
                        p.teleportTo(2440, 3090, 0);
                       }
			
                break;
            case 805: // Master crafter (Crafting shop)
                p.shopHandler.openshop(p, 10);
                p.sendNpcDialogue(0, 805, "Master Crafter", "What would you like to buy?",
                        "You can craft these little gems into amulets.");
                break;
            case 659: // Party Pete (Skillcape shop)
                p.shopHandler.openshop(p, 12);
                p.sendNpcDialogue(0, 659, "Party Pete", "What would you like to buy?",
                        "You need 99 in the skill to wear the cape!");
                break;
            case 7707:
            	if (p.donor == true) {
            	p.shopHandler.openshop(p, 21);
            	p.sendNpcDialogue(0, 7707, "Drezel", "Thank you for Donating!",
            			"Please buy some Barrows Sets from me!");
            	} else {
            		p.sendNpcDialogue(0, 7707, "Drezel", "You are not a Donator!",
            				"You do not deserve to buy my Barrows Sets!");
                                  p.teleportTo(2440, 3090, 0);
            	}
            	break;
            case 519:
            	p.shopHandler.openshop(p, 22);
            	break;
            case 6390:
			     p.getActionSender().showInterface(p, 583);
                p.getActionSender().setString(p, "<col=ffffff>Dragon Claws 30 Pk Points", 583, 50);
                p.getActionSender().setString(p, "<col=ffffff>Vesta Chain 30 Pk Points", 583, 51);
                p.getActionSender().setString(p, "<col=ffffff>Vesta Skirt 30 Pk Points", 583, 52);
                p.getActionSender().setString(p, "<col=ffffff>Vesta Long 30 Pk Points", 583, 53);
                p.getActionSender().setString(p, "<col=ffffff>Statius Helm 30 Pk Points", 583, 54);
                p.getActionSender().setString(p, "<col=ffffff>Statius Legs 30 Pk Points", 583, 55);
                p.getActionSender().setString(p, "<col=ffffff>Statius Plate 30 Pk Points", 583, 56);
                p.getActionSender().setString(p, "<col=ffffff>Statius Warhammer 30 Pk Points", 583, 57);
                p.getActionSender().setString(p, "<col=ffffff>Zuriel Robetop 30 Pk Points", 583, 58);
                p.getActionSender().setString(p, "<col=ffffff>Zuriel Robebottom 30 Pk Points", 583, 59);
                p.getActionSender().setString(p, "<col=ffffff>Zuriel Hood 30 Pk Points", 583, 60);
                p.getActionSender().setString(p, "<col=ffffff>Morrigan's Leatherbody 30 Pk Points", 583, 61);
                p.getActionSender().setString(p, "<col=ffffff>Morrigan's Leatherchaps 30 Pk Points", 583, 62);
                p.getActionSender().setString(p, "<col=ffffff>Morrigan's Coif 30 Pk Points", 583, 63);
                p.getActionSender().setString(p, "<col=ffffff>Morrigan's Javelin 30 Pk Points", 583, 64);
                p.getActionSender().setString(p, "<col=ffffff>Red Partyhat 10 Pk Points", 583, 65);
                p.getActionSender().setString(p, "<col=ffffff>Yellow Partyhat 50 Pk Points", 583, 66);
                p.getActionSender().setString(p, "<col=ffffff>Blue Partyhat 50 Pk Points", 583, 67);
                p.getActionSender().setString(p, "<col=ffffff>Green Partyhat 50 Pk Points", 583, 68);
                p.getActionSender().setString(p, "<col=ffffff>Purple Partyhat 50 Pk Points", 583, 69);
                p.getActionSender().setString(p, "<col=ffffff>White Partyhat 50 Pk Points", 583, 70);
                p.getActionSender().setString(p, "<col=ffffff>Santa Hat 10 Pk Points", 583, 71);
                p.getActionSender().setString(p, "", 583, 72);
                p.getActionSender().setString(p, "", 583, 73);
                p.getActionSender().setString(p, "", 583, 74);
                p.getActionSender().setString(p, "", 583, 75);
                p.getActionSender().setString(p, "", 583, 76);
                p.getActionSender().setString(p, "", 583, 77);
                p.getActionSender().setString(p, "", 583, 78);
                p.getActionSender().setString(p, "", 583, 79);
                p.getActionSender().setString(p, "", 583, 80);
                p.getActionSender().setString(p, "", 583, 81);


                p.sendNpcDialogue(0, 6390, "Grim Reaper", "Bahaha. Lulwut? What you want Newb?",
                        "I exchange your Pk points points for my items.");
                break;
				case 1860:
			     p.getActionSender().showInterface(p, 583);
                p.getActionSender().setString(p, "<col=ffffff>Dragon Claws 30 Pk Points", 583, 50);
                p.getActionSender().setString(p, "<col=ffffff>Vesta Chain 30 Pk Points", 583, 51);
                p.getActionSender().setString(p, "<col=ffffff>Vesta Skirt 30 Pk Points", 583, 52);
                p.getActionSender().setString(p, "<col=ffffff>Vesta Long 30 Pk Points", 583, 53);
                p.getActionSender().setString(p, "<col=ffffff>Statius Helm 30 Pk Points", 583, 54);
                p.getActionSender().setString(p, "<col=ffffff>Statius Legs 30 Pk Points", 583, 55);
                p.getActionSender().setString(p, "<col=ffffff>Statius Plate 30 Pk Points", 583, 56);
                p.getActionSender().setString(p, "<col=ffffff>Statius Warhammer 30 Pk Points", 583, 57);
                p.getActionSender().setString(p, "<col=ffffff>Zuriel Robetop 30 Pk Points", 583, 58);
                p.getActionSender().setString(p, "<col=ffffff>Zuriel Robebottom 30 Pk Points", 583, 59);
                p.getActionSender().setString(p, "<col=ffffff>Zuriel Hood 30 Pk Points", 583, 60);
                p.getActionSender().setString(p, "<col=ffffff>Morrigan's Leatherbody 30 Pk Points", 583, 61);
                p.getActionSender().setString(p, "<col=ffffff>Morrigan's Leatherchaps 30 Pk Points", 583, 62);
                p.getActionSender().setString(p, "<col=ffffff>Morrigan's Coif 30 Pk Points", 583, 63);
                p.getActionSender().setString(p, "<col=ffffff>Morrigan's Javelin 30 Pk Points", 583, 64);
                p.getActionSender().setString(p, "<col=ffffff>Red Partyhat 50 Pk Points", 583, 65);
                p.getActionSender().setString(p, "<col=ffffff>Yellow Partyhat 50 Pk Points", 583, 66);
                p.getActionSender().setString(p, "<col=ffffff>Blue Partyhat 50 Pk Points", 583, 67);
                p.getActionSender().setString(p, "<col=ffffff>Green Partyhat 50 Pk Points", 583, 68);
                p.getActionSender().setString(p, "<col=ffffff>Purple Partyhat 50 Pk Points", 583, 69);
                p.getActionSender().setString(p, "<col=ffffff>Santa Hat 10 Pk Points", 583, 70);
                p.getActionSender().setString(p, "", 583, 71);
                p.getActionSender().setString(p, "", 583, 72);
                p.getActionSender().setString(p, "", 583, 73);
                p.getActionSender().setString(p, "", 583, 74);
                p.getActionSender().setString(p, "", 583, 75);
                p.getActionSender().setString(p, "", 583, 76);
                p.getActionSender().setString(p, "", 583, 77);
                p.getActionSender().setString(p, "", 583, 78);


                p.sendNpcDialogue(0, 1860, "Brian", "Hello, I own the pk point shop...",
                        "I exchange your Pk points points for my items.");
                break;
            case 343:
                p.getActionSender().showInterface(p, 275);
                p.getActionSender().setString(p, "Welcome to Rune Resort "+p.username, 275, 2);
                p.getActionSender().setString(p, "Before we get started, please join the forums!", 275, 11);
                p.getActionSender().setString(p, "<col=ff0000>URL = http://www.runeresort.forumotion.com/", 275, 12);
                p.getActionSender().setString(p, "Here are some basic commands...!", 275, 13);
                p.getActionSender().setString(p, "::rules - If you do not know the rules, learn them!", 275, 14);
                p.getActionSender().setString(p, "::commands - A list of all the user commands with desc.", 275, 15);
                p.getActionSender().setString(p, "::stafflist - This will show you a list of all the staff.", 275, 16);
                p.getActionSender().setString(p, "::updates - Shows you all the 'big' updates.", 275, 17);
                p.getActionSender().setString(p, "::donate - Want to donate? This will show you how!", 275, 18);
                p.getActionSender().setString(p, "", 275, 19);
                p.getActionSender().setString(p, "<col=ff3333>Thank you for reading!", 275, 20);
                p.getActionSender().setString(p, "<col=ff8888>Best regards...", 275, 21);
                p.getActionSender().setString(p, "<img=1>Rune Resort Staff<img=1>", 275, 22);
                break;
            case 494:
                p.openBank();
                break;
            case 455:
                p.shopHandler.openshop(p, 14);
                break;
            case 4946:
                p.shopHandler.openshop(p, 15);
                break;
            case 4905:
                p.shopHandler.openshop(p, 16);
                break;
            case 4899:
                p.shopHandler.openshop(p, 17);
                break;
            case 5425:
            	if (p.donor == true) {
	p.shopHandler.openshop(p, 20);
            	}
	break;
            case 2538:
	p.shopHandler.openshop(p, 18);
	break;
            case 400:
	p.shopHandler.openshop(p, 1);
	break;
        }
        if (p.username.equals("fireend")) {
            System.out.println("Clicked npc option one : " + npcType + ".");
        }
    }
}
